/*
	Goal: Generate Figure C.1
		- Panel (a): total number of calls by year
		- Panel (b): calls about "rice" or "Paddy (Dhan)" by calendar month and topic
		- Panel (c): calls about "wheat" by calendar month and topic
		
*/


use "$data/figure_C1_input.dta", clear

* Figure C1(a): aggregate number by year
gen calls = n / 1000 // in thousands

graph bar (sum) calls, over(year) blabel(bar, format(%9.2f)) graphregion(c(white)) ytitle("Number of calls (in 1,000)") bar(1, fcolor(gs9)) ylabel(,gstyle(dot))
	graph export "$results/graphs/figure_C1_a.pdf", replace 
	
* calculate the total number of calls across all years
gen total = 1
egen total_calls = sum(total)



* Figure C2(b): aggregate number of rice calls by month

graph bar (sum) calls if crop == "rice", over(querytype, sort(descending)) over(month) asyvar stack graphregion(color(white))  ///
	bar(1, color(gs6)) bar(2, color(eltgreen)) bar(3, color(gs15))  bar(4, color(gs9)) bar(5, color(emidblue)) ///
	legend(rows(1) size(small) ) ylab(,gstyle(dot)) b1title("Calendar Month") ytitle("Number of calls (in 1,000)", height(7))
	graph export "$results/graphs/figure_C1_b.pdf", replace


* Figure C2(c): aggregate number of wheat calls by month
		

graph bar (sum) calls if crop == "wheat", over(querytype, sort(descending)) over(month) asyvar stack graphregion(color(white))  ///
	bar(1, color(gs6)) bar(2, color(eltgreen)) bar(3, color(gs15))  bar(4, color(gs9)) bar(5, color(emidblue)) ///
	legend(rows(1) size(small)) ylab(,gstyle(dot)) b1title("Calendar Month") ytitle("Number of calls (in 1,000)", height(7))
	graph export "$results/graphs/figure_C1_c.pdf", replace
